package com.gz.EuchreU.Contants;

import com.badlogic.gdx.math.Vector2;

public class CardLocations {
	
	
	
	
	public static Vector2 GetPlayerCardLocation(int pPlayerID){
		float buffer = UI.getCardWidth()/4;
		
		
		switch (pPlayerID) {
		case GameState.PLAYER_NORTH:
			return new Vector2(UI.getWidth()/2 - 2*UI.getCardWidth(),buffer);
		case GameState.PLAYER_EAST:
			return new Vector2(
					UI.getWidth() - UI.getCardWidth() - buffer,
					UI.getHeight()/2 - 2f*UI.getCardWidth());
		case GameState.PLAYER_SOUTH:
			return new Vector2(UI.getWidth()/2 - 2*UI.getCardWidth(),UI.getHeight() - UI.getCardHeight() - buffer);
		case GameState.PLAYER_WEST:
			return new Vector2(
					buffer,
					UI.getHeight()/2 - 2f*UI.getCardWidth());
		default:
			return new Vector2();
		}
	}
	
	public static Vector2 GetTrickCardLocation(int pPlayerID){
		float buffer = UI.getCardWidth()/4;
		
		float CenterX = UI.getWidth()/2;
		float CenterY = UI.getHeight()/2;
		float halfW = UI.getCardWidth()/2;
		float halfH = UI.getCardWidth()/2;
		
		switch (pPlayerID) {
		case GameState.PLAYER_NORTH:
			return new Vector2(CenterX - halfW, CenterY - UI.getCardHeight() - buffer);
		case GameState.PLAYER_EAST:
			return new Vector2(CenterX + UI.getCardWidth()/2 + buffer,CenterY - halfH);
		case GameState.PLAYER_SOUTH:
			return new Vector2(CenterX - halfW,CenterY + buffer);
		case GameState.PLAYER_WEST:
			return new Vector2(CenterX - 1.5f*UI.getCardWidth() - buffer,CenterY - halfH);
		default:
			return new Vector2();
		}
	}
	
	public static Vector2 GetDealerChipLocation(){
		float buffer = UI.getCardWidth()/4;
		Vector2 vReturn = GetPlayerCardLocation(GameState.getDealer());
		
		switch (GameState.getDealer()) {
		case GameState.PLAYER_NORTH:
			//vReturn.y += UI.getCardHeight() + buffer;
			break;
		case GameState.PLAYER_EAST:
			vReturn.x += UI.getCardWidth() - buffer;
			//vReturn.y += UI.getCardWidth();
			break;
		case GameState.PLAYER_SOUTH:
			vReturn.y += UI.getCardWidth() - buffer;
			break;
		case GameState.PLAYER_WEST:
			vReturn.x = buffer;
			//vReturn.x += UI.getCardHeight() + buffer;
			//vReturn.y += UI.getCardWidth();
			break;
		default:
			return new Vector2();
		}
		
		return vReturn;
	}

	public static Vector2 GetCalledChipLocation(){
		float buffer = UI.getCardWidth()/4;
		Vector2 vReturn = GetPlayerCardLocation(GameState.GetOrderedPlayerID());
		switch (GameState.getDealer()) {
		case GameState.PLAYER_NORTH:
			//vReturn.y += UI.getCardHeight() + buffer;
			vReturn.x += 3.5*UI.getCardWidth();
			break;
		case GameState.PLAYER_EAST:
			vReturn.x += UI.getCardWidth() - buffer;
			vReturn.y += 4*UI.getCardWidth();
			break;
		case GameState.PLAYER_SOUTH:
			vReturn.y += UI.getCardWidth() - buffer;
			vReturn.x += 3.5f*UI.getCardWidth();
			break;
		case GameState.PLAYER_WEST:
			vReturn.x = buffer;
			vReturn.y += 4*UI.getCardWidth();
			break;
		default:
			return new Vector2();
		}
		
		return vReturn;
	}
	
}
